/**
 * 技师管理的列表
 * @author: minzhang
 * @update: 2016-10-13
 */

import React, { PropTypes } from 'react';
import { Row, Col, Button, Table, Popconfirm, Pagination, Icon, Tooltip, message } from 'antd';
//import styles from './TechManageList.less';

function RoomsManageList({
  total, pageNumber, pageSize, loading, dataSource,
	onSelectChange, onPageChange, onShowSizeChange,
	onAdd, onEditItem, onDeleteItem
}) {
		
	const columns = [{
	  title: '包间名',
	  dataIndex: 'name',
	  key: 'name',
	}, {
	  title: '包间类型',
	  dataIndex: 'type',
	  key: 'type',
  },{
	  title: '容纳人数',
	  dataIndex: 'num',
	  key: 'num',
		sorter: (a, b) => a.reserve_times - b.reserve_times,
	},{
	  title: '操作',
	  dataIndex: 'ope',
	  key: 'ope',
	  render: (text, record) => {
			return (
				<Row>
					<Col span={6} offset={6}><a onClick={() => onEditItem(record.tech_id)}>编辑</a></Col>
					<Col span={6}><Popconfirm title="确定要删除吗？" onConfirm={() => onDeleteItem(record.tech_id)}><a>删除</a></Popconfirm></Col>
				</Row>
			);
		}
	}];
		
  return (
    <div style={{overflow: 'hidden'}}>
        <Table 
           columns={columns} 
           dataSource={dataSource} 
           loading={loading} 
           pagination={false}
           title={
            () => 
						<div className="tr">
         			<Button onClick={onAdd} type="primary" icon="plus">添加包间</Button>
         		</div>
          } 
          bordered 
        />
        <Pagination
          className="ant-table-pagination"
          total={total}
          showTotal={total => `共 ${total} 条`}
          current={pageNumber}
          showSizeChanger 
          showQuickJumper 
          pageSize={pageSize}
          onChange={onPageChange}
          onShowSizeChange={onShowSizeChange}
        />
    </div>
  );
}

RoomsManageList.propTypes = {
	total: PropTypes.any,
  pageNumber: PropTypes.any,
	loading: PropTypes.any,
	dataSource: PropTypes.array,
  onSelectChange: PropTypes.func,
  onPageChange: PropTypes.func,
  onAdd: PropTypes.func,
	onEditItem: PropTypes.func,
};

export default RoomsManageList;